<template>
  <div id="app">
    <router-view v-if="isShow" />
  </div>
</template>

<script>
import {setCookie,getCookie} from "@/utils/util"
import {getDictionaryList} from "@/api/dictionary"
export default {
     provide() {
      // let obj = await this.getDictionaryList();
      return {
        reload: this.reload,
        // ...obj,
      };
    },
  name: "App",
  data() {
    return {
      isShow: true, 
    };
  },
  mounted() {
    // console.log( this.$store);
    this.getDictionaryList();
  },
  methods: {
    reload() {
      this.isShow = false;
      this.$nextTick(() => {
        this.isShow = true;
      });
    },
    async getDictionaryList() {
      let arr = [
        "mdse_dictionary",
        "mdse_dictionary_class_ification",
        "order_goods_type",
        "user_role",
        "mdse_platform",
      ];
      let obj = {};
      for (const item of arr) {
        let res = await getDictionaryList(item);
        obj[item] = res;
        setCookie(item,JSON.stringify(res))
      }
     
      
     
      this.$store.commit("setDictionary", obj);
      return obj;
    },
  },
};
</script>

<style>
@import url("./assets/scss/index.css");
html,
body {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 0px;
  margin: 0px;
}
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  widows: 100%;
  height: 100%;
}
</style>
